cmake_minimum_required (VERSION 3.10)

project(example_mysql_connector)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# mysql connector
set(mysql-concpp_DIR /usr/local/mysql/connector-c++-9.1.0)
find_package(mysql-concpp QUIET)
include_directories(${MYSQL_CONCPP_INCLUDE_DIR})
link_directories(${MYSQL_CONCPP_RUNTIME_LIBRARY_DIR})

if(mysql-concpp_FOUND)
    message(STATUS "build ${PROJECT_NAME}")
    aux_source_directory(. DIR_SOURCES)
    add_executable (${PROJECT_NAME} ${DIR_SOURCES})

    target_link_libraries(${PROJECT_NAME} pthread)
    target_link_libraries(${PROJECT_NAME} glog)
    target_link_libraries(${PROJECT_NAME} mysqlcppconnx)
endif()